package org.cycuchy.hp.components.book.map {
	
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	public class InfoWindowSprite extends Sprite {
		
	  private var bodyTextField:TextField;
	  private var titleTextField:TextField;
	  
	  public function InfoWindowSprite() {
	      // Draw info window frame
	    graphics.lineStyle(2, 0x434343, 1, true);
	    graphics.beginFill(0xFFFFFF);
	    //graphics.drawRoundRect(-100, -110, 180, 105, 10, 10);
	    graphics.drawRoundRect(-100, -110, 185, 100, 10, 10);
	    graphics.moveTo(-10, -10);
	    graphics.lineTo(0, 10);
	    graphics.lineTo(10, -10);
	    graphics.lineStyle(2, 0xFFFFFF);
	    graphics.lineTo(-10, -10);
	    graphics.endFill();
	    
	    // Draw close area circle
	    graphics.beginFill(0x434343);
	    graphics.drawCircle(60, -105, 15);
	    graphics.endFill();
	    
	    // Add close 'X'
	    var xTextFormat:TextFormat = new TextFormat();
	    xTextFormat.font = "Verdana";
	    xTextFormat.size = 16;
	    xTextFormat.color = 0xFFFFFF;
	    xTextFormat.bold = true;
	    
	    var xText:TextField = new TextField();
	    xText.x = 52;
	    xText.y = -117;
	    xText.text = "X";
	    //xText.embedFonts = true;
	    xText.selectable = false;
	    xText.setTextFormat(xTextFormat);
	    addChild(xText);
	    
	    // Add title
//	    var titleTextFormat:TextFormat = new TextFormat();
//	    titleTextFormat.font = "Verdana";
//	    titleTextFormat.color = 0x0898BE;
//	    titleTextFormat.bold = true;
//	    titleTextFormat.size = 16;
	    
	    titleTextField = new TextField();
	    titleTextField.width = 140;
	    titleTextField.x = -95;
	    titleTextField.y = -110;
//	    titleTextField.text = "AAAAAAAAA";
	    //xText.embedFonts = true;
	    titleTextField.selectable = false;
//	    titleTextField.setTextFormat(titleTextFormat);
	    addChild(titleTextField);
	    
	    
	    
	    // Add body text
	    var bodyTextFormat:TextFormat = new TextFormat();
//	    bodyTextFormat.font = "Verdana";
//	    bodyTextFormat.color = 0xFF0000;
	    //bodyTextFormat.size = 30;
	    bodyTextFormat.align = "center";
	    
	    bodyTextField = new TextField();
	    bodyTextField.x = -95;
	    bodyTextField.y = -80;
	    bodyTextField.width = 150;
	    bodyTextField.wordWrap = true;
	    //bodyTextField.text = "";
	    //bodyTextField.embedFonts = true;
	    bodyTextField.selectable = false;
	    bodyTextField.multiline = true;
	    bodyTextField.setTextFormat(bodyTextFormat);
	    addChild(bodyTextField);
	    
	    cacheAsBitmap = true;
	  }
	  
	  public function set bodyText(value:String):void {
	  	bodyTextField.htmlText = value;
	  }

	  public function set titleText(value:String):void {
	  	titleTextField.htmlText = value;
	  }
	  
//	  public function change():void {
//	      bodyTextField.y = -90;
//	  }
	  
	}
	
}